package com.woniuxy.project.campus.canteen.controller;


import com.woniuxy.project.campus.canteen.service.BusinessInfoService;
import com.woniuxy.project.campus.canteen.service.ShopsService;
import com.woniuxy.project.campus.canteenModelform.EditShopTime;
import com.woniuxy.project.campus.canteenModelform.GetShopTimeFoem;
import com.woniuxy.project.campus.util.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 猫将军
 * @since 2025年02月17日
 */
@RestController
@RequestMapping("/businessInfo")
public class BusinessInfoController {

    @Resource
    private BusinessInfoService businessInfoService;


    //商家修改店铺营业时间接口
    @ApiOperation(value = "商家修改店铺营业时间接口")
    @PostMapping("/editShopTime")
    public Result editShopTime(@RequestHeader("token") String token, @RequestBody EditShopTime editShopTime) throws Exception{
        businessInfoService.editShopTime(token,editShopTime);
        return Result.success("修改成功");
    }

    //获取营业时间
    @ApiOperation(value = "商家获取营业时间")
    @GetMapping("/getShopTime")
    public Result getShopTime(@RequestHeader("token") String token) throws Exception{
        GetShopTimeFoem editShopTime = businessInfoService.getShopTime(token);
        return Result.success(editShopTime);
    }

}

